/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.udt.generator.api;

import com.inspur.edp.cef.designtime.api.entity.ClassInfo;
import com.inspur.edp.cef.designtime.api.entity.DataTypeAssemblyInfo;
import com.inspur.edp.udt.designtime.api.entity.UnifiedDataTypeDef;
import com.inspur.edp.udt.designtime.api.entity.element.UdtElement;

public final class ApiHelper
{
//C# TO JAVA CONVERTER TODO TASK: Extension methods are not available in Java:
//ORIGINAL LINE: public static ClassInfo GetEntityAllInterfaceClassName(this UnifiedDataTypeDef udt)
	public static ClassInfo GetEntityAllInterfaceClassName(UnifiedDataTypeDef udt)
	{
//C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java:
		DataTypeAssemblyInfo apiAssemblyInfo = udt.getApiNamespace();
		return new ClassInfo(udt.getApiNamespace(), "I"+udt.getCode()+"entity", apiAssemblyInfo.getDefaultNamespace());
	}

	public static ClassInfo GetEntityInterfaceClassName(UnifiedDataTypeDef udt)
	{
//C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java:
		DataTypeAssemblyInfo apiAssemblyInfo = udt.getApiNamespace();
		return new ClassInfo(udt.getApiNamespace(), "I"+udt.getCode()+"InnerEntity", apiAssemblyInfo.getDefaultNamespace());
	}

	public static ClassInfo GetBEMgrInterfaceClassName(UnifiedDataTypeDef udt)
	{
//C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java:
		DataTypeAssemblyInfo apiAssemblyInfo = udt.getApiNamespace();
		return new ClassInfo(udt.getApiNamespace(),"I"+udt.getCode()+"BEManager", apiAssemblyInfo.getDefaultNamespace());
	}

	public static ClassInfo GetBEMgrAllInterfaceClassName(UnifiedDataTypeDef udt)
	{
//C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java:
		DataTypeAssemblyInfo apiAssemblyInfo = udt.getApiNamespace();
		return new ClassInfo(udt.getApiNamespace(), "I"+udt.getCode()+"Service", apiAssemblyInfo.getDefaultNamespace());
	}

	//TODO: 挪到DataTypeField上, 把cef里的ElementAssoGeneator/EntityElementAssoGenerator.GetName()/GetNamespace()一块改了
	public static ClassInfo GetElementAssoClassName(UdtElement item)
	{
//C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java:
		DataTypeAssemblyInfo entityAssemblyInfo = ((UnifiedDataTypeDef)item.getBelongObject()).getEntityAssemblyInfo();
		return new ClassInfo(entityAssemblyInfo, item.getLabelID() + "Info", entityAssemblyInfo.getDefaultNamespace());
	}

	//TODO: 挪到DataTypeField上, 把cef里的ElementEnumGeneator.GetName()/GetNamespace()一块改了
	public static ClassInfo GetElementEnumClassName(UdtElement item)
	{
//C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java:
		DataTypeAssemblyInfo entityAssemblyInfo = ((UnifiedDataTypeDef)item.getBelongObject()).getEntityAssemblyInfo();
		return new ClassInfo(entityAssemblyInfo, item.getLabelID() + "Enum", entityAssemblyInfo.getDefaultNamespace());
	}

	public static ClassInfo GetDataTypeSerializerItemClassName(UnifiedDataTypeDef obj)
	{
//C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java:
		DataTypeAssemblyInfo nameSpace = obj.getEntityAssemblyInfo();
		return new ClassInfo(nameSpace, obj.getCode() + "SerItem", nameSpace.getDefaultNamespace());
	}
}
